import request from '@/utils/request'
import { downFile } from '@/utils/request'
/**
* 订单信息表分页查询
* @param {查询条件} data
*/
export function listOrderInfo(query) {
  return request({
    url: 'production/orderplan/list',
    method: 'get',
    params: query,
  })
}

/**
* 新增订单信息表
* @param data
*/
export function addOrderInfo(data) {
  return request({
    url: 'production/orderplan',
    method: 'post',
    data: data,
  })
}
/**
* 修改订单信息表
* @param data
*/
export function updateOrderInfo(data) {
  return request({
    url: 'production/orderplan',
    method: 'PUT',
    data: data,
  })
}
/**
 * 激活订单
 */
export function updateOrderState(id,state){
  const data={
    id,
    state
  }
  return request({
    url:'production/orderplan/activate',
    method:'PUT',
    params:data
  })
}
/**
* 获取订单信息表详情
* @param {Id}
*/
export function getOrderInfo(id) {
  return request({
    url: 'production/orderplan/' + id,
    method: 'get'
  })
}

/**
* 删除订单信息表
* @param {主键} pid
*/
export function delOrderInfo(pid) {
  return request({
    url: 'production/orderplan/delete/' + pid,
    method: 'delete'
  })
}
// 导出订单信息
export async function exportOrderPlan(query) {
  await downFile('production/orderplan/export', { ...query })
}
